<%@page contentType="text/html; charset=UTF-8"%>
<%@taglib uri="/WEB-INF/struts-tags.tld" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<%@include file="indicateInclude.jsp"%>
<SCRIPT type="text/javascript">
var addBtn,delBtn,saveBtn;
window.addEvent('load', function(){
	in_init();
});
function in_init(){
	addBtn = new Jx.Button({
			id:'addBtnJx',
			label:'增加子节点',
			onClick:function(){addIndi();}
		});
	addBtn.addTo("addBtn");
	delBtn = new Jx.Button({
		id:'delBtnJx',
		label:'删除该节点',
		onClick:function(){delIndi();}
	});
	delBtn.addTo("delBtn");
	saveBtn = new Jx.Button({
		id:'addBtnJx',
		label:'保存该节点',
		onClick:function(){saveIndi();}
	});
	saveBtn.addTo("saveBtn");
	var inTree = new Jx.Tree({parent:'treeArea'});
	var inRoot = new Jx.TreeFolder({label:'指标管理:root',onClick:function(){getChild(this)}});
	inTree.append(inRoot);
}
function addIndi(){
	$("call").value="add";
	$("parentCls").value = $("clsCode").value;
	$("clsCode").value="";
	$("clsCode").readOnly=false;
	$("clsName").value = "";
	addBtn.setEnabled(false);
	delBtn.setEnabled(false);
	saveBtn.setEnabled(true);
}
function delIndi(){
	var cc_ = $("clsCode").value;
	if(cc_.length < 1){
		alert("请选择指标代码！");
		return false;
	}
	$("call").value="del";
	addBtn.setEnabled(false);
	saveBtn.setEnabled(false);
	$("inForm").submit();
}
function saveIndi(){
	addBtn.setEnabled(false);
	delBtn.setEnabled(false);
	saveBtn.setEnabled(false);
	var cc_ = $("clsCode").value;
	if(cc_.length < 1){
		alert("请输入代码！");
		return false;
	}
	var cn_ = $("clsName").value;
	if(cn_.length < 1){
		alert("请输入"+$("clsCode").value+"的名称!");
		return false;
	}
	$("inForm").submit();
}
function getClsInfo(clsCode){
	var xhConn1 = new XHConn();
	xhConn1.connect(callURL,"POST","call=getInfo&clsCode="+clsCode,
		function (xh){
			var res = eval('('+xh.responseText+')');
			if(res){
				var r_msg = res.msg;
				$("clsCode").value=r_msg.clsCode;
				$("clsCode").readOnly=true;
				$("clsName").value = r_msg.clsName;
				$("clsLevel").value = r_msg.clsLevel;
				$("parentCls").value = r_msg.parentCls;
				$("call").value="update";
				addBtn.setEnabled(true);
			}else{
				var d1 = new Jx.Dialog({
					label:'提示信息',
					modal:true,
					resize:false,
					move:false,
					content:'请求失败!'
				});
				d1.open.bind(d1);
			}
		}	
	);
}

</SCRIPT>
</head>
<body style="margin-left:10px;margin-top:20px">
	<DIV style="padding-left:5px;text-align:left;padding-top:5px;float:left;margin-left:10px;border-right:#506b93 1px solid;border-left:#506b93 1px solid;border-top:#506b93 1px solid;border-bottom:#506b93 1px solid">
		<!-- 树区 -->
		<div style="float:left;width:350px;">
			<div id="treeArea" style="width:130px;"></div>
		</div>
		<!-- 内容区 -->
		<form name="inForm" action="<%=request.getContextPath() %>/manager/indicate.do" method="post" id="inForm">
		<div style="float:left;width:280px;">
			<div style="height:40px;">代码编号：<input type="text" name="clsCode" id="clsCode"></div>
			<div style="height:40px;">代码名称：<input type="text" name="clsName" id="clsName"></div>
			<div>
				<input type="hidden" name="parentCls" id="parentCls">
				<input type="hidden" name="clsLevel" id="clsLevel">	
				<input type="hidden" name="call" id="call">
			</div>
			<div id="addBtn"></div>
			<div id="delBtn"></div>
			<div id="saveBtn"></div>
		</div>
		</form>
	</DIV>
</body>
<script language='javascript'>
</script>
</html>